$(function(){
    $('.content_box .button_01').click(function () {
        $('.background_01').show();
        $('.drawGame').show();
    });
    $('.button_02').click(function () {

        //整个随机数测试
        /*var rand = "";
        for(var i = 0; i < 3; i++){
            var r = Math.floor(Math.random() * 10);
            rand += r;
        }
        console.log(rand);*/

        var load = new Loading();
        load.init();
        $.ajax({
            url: "/drawGame/actionDraw.html",
            //data: {"aaaa":rand},
            type: "POST",
            dataType: "json",
            beforeSend: function () {

                load.start();
            },//执行ajax前执行loading函数.直到success
            success: function (data) {
                console.log(data);
                load.stop();
                if (data.code != 1) {
                    alert(data.msg);
                    return;
                }

                //code=1 加载抽的签
                $('.background_01').hide();
                $('.drawGame').hide();
                $('.button_01').hide();
                console.log(data.data.picUrl);
                var pic1=data.data.picUrl
                $('.content_box .background_photo').attr('src',pic1);



                //$('.content_box').html();

               // location.href = "/pay/pay/ " + data.data.orderId + " .html";
            },
            error: function (data) {

                //console.log(data);
                load.stop();

                alert("错误！！！");
            }
        })
    })
})